﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PM.Web
{
    public partial class TopicList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bindData();
            }
        }

        private void bindData()
        {
            int cid; if (int.TryParse(Request.QueryString["cid"], out cid))
            {
                this.litTitle.Text = Request.QueryString["typename"] + "列表";

                DataAccess.PmData dal = new DataAccess.PmData();
                System.Data.DataTable dt = new System.Data.DataTable();
                dt = dal.GetTopicList(Common.GetCommunityCode(), null, cid, Request.QueryString["typename"].Trim(), null);
                AspNetPager1.RecordCount = dt.Rows.Count;
                PagedDataSource pds = new PagedDataSource();
                pds.AllowPaging = true;
                pds.PageSize = AspNetPager1.PageSize;
                pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
                pds.DataSource = dt.DefaultView;
                this.repTopicList.DataSource = pds;
                this.repTopicList.DataBind();
            }
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            bindData();
        }
    }
}